try:
tval1 = stage.get_background()
except:
tval1 = "DNE"
try:
tval2 = sprite.get_name()
tval3 = sprite.get_x()
tval4 = sprite.get_y()
except:
tval2 = "DNE"
tval3 = "DNE"
tval4 = "DNE"
t1 = TestObjective()
t1.add_success(tval1 == 'moon', "Great job!")
t1.add_failure(tval1 == None, "Did you add a background?")
t1.add_creative(tval1 != None and tval1 != 'moon', "That's a nice background too!")
t2 = TestObjective()
t2.add_success(tval2 == "hedgehog" and tval3 == 0 and tval4 == -210, "Great job!")
t2.add_failure(tval2 == "DNE", "Did you add a Sprite at Position?")
t2.add_failure(tval2 == "codester", "Did you change the image of your sprite to \"hedgehog\"?")
t2.add_failure(tval3 != 0 and tval4 != -210, "Did you change the sprite's xy-coordinates?")
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)